package ex8;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;



public class Test1 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		HashMap<String, Integer> treeMap = new HashMap<String, Integer>();
		while (scanner.hasNextLine()) {
			String string = scanner.nextLine();
			if (string.equals("!!!!!")) {
				break;
			} else {
				String[] strings = string.split(" +");
				for (String string2 : strings) {
					if (string2.length() == 0) {
						continue;
					}
					Integer xInteger = treeMap.get(string2);
					if (xInteger == null) {
						treeMap.put(string2, 1);
					} else {
						treeMap.put(string2, xInteger + 1);
					}
				}
			}
		}
		scanner.close();
		ArrayList<Map.Entry<String, Integer>> arrayList = new ArrayList<Map.Entry<String, Integer>>(treeMap.entrySet());
			
		Collections.sort(arrayList, new Comparator<Map.Entry<String, Integer>>() {

			@Override
			public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
				if(o2.getValue() - o1.getValue()!=0)
                    return o2.getValue() - o1.getValue();
                return o1.getKey().compareTo(o2.getKey());
			}
			
		});
		
		
		System.out.println(arrayList.size());
		int n = Math.min(arrayList.size(), 10);
		
		for (int i = 0; i < n; i++) {
			System.out.println(arrayList.get(i).getKey() + "=" + arrayList.get(i).getValue());
		}
		
		
	}
}